{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "78991c2a",
   "metadata": {},
   "source": [
    "##上周回顾"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48124569",
   "metadata": {},
   "outputs": [],
   "source": [
    "# list 的一般方法/函数的使用及案例\n",
    "#append()增加，增加到list元素到list元素、到list 的末尾。常用于新建列表\n",
    "2.pop(index)/remove(va1ues）对两者优势\n",
    "3.count（）查看某个元素出现的次数\n",
    "4.index（）查看某个元素第一次出现的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e0952514",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = 'Milliways'\n",
    "#检查 word中出现的元音，并打印出来 怎么做？\n",
    "#for letter in word:  # 第一个元素letter 请不要和已有变量重名\n",
    "#第一个元素一般不定义名字，常用item（元素）来命名\n",
    "#简写i来命名\n",
    "#第二个元素word（重要），意味着将遍历的内容\n",
    "#遍历的内容一般是 序列数据 str list\n",
    "for letter in word:\n",
    "    if letter in vowels:\n",
    "        print (letter)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3a7738c",
   "metadata": {},
   "source": [
    ">* vowels2. py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a8fc26b4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['i', 'a']"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用append（）新建列表\n",
    "found = []\n",
    "for letter in word:\n",
    "# print(letter)\n",
    "     if letter in vowels: #letter 在原因字母表中\n",
    "        if letter not in found: #letter 不在found表中\n",
    "            found.append(letter) \n",
    "found"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "28fce666",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecb6b8fb",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "cf45f2b2",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-9-daa108bef64a>, line 5)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  File \u001b[0;32m\"<ipython-input-9-daa108bef64a>\"\u001b[0;36m, line \u001b[0;32m5\u001b[0m\n\u001b[0;31m    if user_\u001b[0m\n\u001b[0m            ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "#商品信息的数据存放（商品名称，商品价格，商品编号）\n",
    "print('支付宝余额')\n",
    "goods_list = [\n",
    "   [华为手机，8000],\n",
    "   [小米手环，199],    #我们认为，每一个商品的内容是一个多个值的值，可用list\n",
    "]\n",
    "print('商品编号：')\n",
    "#用户购物信息的数据存放\n",
    "user_shopping_list = [] #增加进来可考虑用append（）方法\n",
    "#用户输入余额信息\n",
    "alipay = input('请输入支付宝余额')\n",
    "#打印商品信息\n",
    "info ='''------ good list ------\n",
    "商品编号：%s,商品名称：%s,商品价格：%s\n",
    "商品编号：%s,商品名称：%s,商品价格：%s\n",
    "'''%(0,good_list[0][0],goods_list[0][1],\n",
    "     1,good_list[1][0],goods_list[1][1],\n",
    ")\n",
    "print(info)\n",
    "#list的长度？len()\n",
    "print('------ good list ------')\n",
    "for i in range(len(good_list)1,(i,good_list[i][0],goods_list[i][1]):\n",
    "    print('商品编号：%s,商品名称：%s,商品价格：%s'%)\n",
    "        \n",
    "               \n",
    "#用户输入商品编号，实现商品查询\n",
    "               choice = intinput('请输入商品编号：')\n",
    "               #判断编号是否存在\n",
    "               \n",
    "if choice < len(good_list):\n",
    "   pass\n",
    "else:\n",
    "               print"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ffb0ff5e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
